﻿namespace Charades.Web.Helpers
{
	using System.Timers;

	public static class TimerHelper
	{
		public static void CreateTimer(double delay, ElapsedEventHandler callback)
		{
			var newTimer = new Timer(delay);
			newTimer.Elapsed += (s, e) =>
			                    {
				                    callback.Invoke(s, e);
									newTimer.Close();
									newTimer.Dispose();
			                    };
			newTimer.AutoReset = true;
			newTimer.Start();
		}
	}
}